# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Jason A. Donenfeld <Jason@zx2c4.com>

pkgname=wireguard-tools
pkgver=1.0.20210914
pkgrel=1
pkgdesc='next generation secure network tunnel - tools for configuration'
arch=('x86_64')
url='https://www.wireguard.com/'
license=('GPL')
depends=('bash')
optdepends=('openresolv: for DNS functionality'
            'sudo: elevate privileges')
validpgpkeys=('AB9942E6D4A4CFC3412620A749FC7012A5DE03AE') # Jason A. Donenfeld <Jason@zx2c4.com>
source=("https://git.zx2c4.com/${pkgname}/snapshot/${pkgname}-${pkgver}.tar"{.xz,.asc})
sha256sums=('97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac'
            'SKIP')

prepare() {
	cd ${pkgname}-${pkgver}/

	find contrib/ -name '.gitignore' -delete
}

build() {
	cd ${pkgname}-${pkgver}/

	make -C src/
}

package() {
	cd ${pkgname}-${pkgver}/

	make -C src/ \
		DESTDIR="${pkgdir}/" \
		WITH_BASHCOMPLETION=yes \
                WITH_WGQUICK=yes \
                WITH_SYSTEMDUNITS=yes \
                install

	install -d -m0755 "${pkgdir}"/usr/share/${pkgname}/
	cp -r contrib/ "${pkgdir}"/usr/share/${pkgname}/examples/
}
